import  java.util.Scanner;

class Worker {
    String _name;
    double _salary;
    Worker(){}
    Worker(String name,double salary){
        _name = name;
        _salary = salary;
    }
    String get_name(){
        return _name;
    }
    double get_salary(){
        return _salary;
    }
    void set_name(String name){
        _name = name;
    }
    void setRate(double salary){
        _salary = salary;
    }

    void pay(int time){
        System.out.println("Not Implemented");
    }

}

class HourlyWorker extends Worker {
    HourlyWorker(String name,double salary){
        _name = name;
        _salary = salary;
    }
    void pay(int time){
        double money;
        if(time<=40) {
            money = time*_salary;
        }
        else {
            money = 40*_salary+(time-40)*2*_salary;
        }

        System.out.println(money);
    }
}
class SalariedWorker extends Worker {
    SalariedWorker(String name,double salary){
        _name = name;
        _salary = salary;
    }
    void pay(int time){
        System.out.println(40*_salary);
    }
    void pay(){
        System.out.println(40*_salary);
    }
}
//Main测试类
public class Main1{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Worker w1 = new Worker("Joe",15);
        w1.pay(35);
        SalariedWorker w2 = new SalariedWorker("Sue",14.5);
        w2.pay();
        w2.pay(60);
        HourlyWorker w3 = new HourlyWorker("Dana", 20);
        w3.pay(25);
        w3.setRate(35);
        int h = input.nextInt();
        w3.pay(h);
    }
}

/* 请在这里填写答案 */